package LuoGu.入门.Davor;

import java.util.Scanner;

public class Main{
    public static void main(String [] args){
        Scanner s = new Scanner(System.in);
        int all = s.nextInt();
        all/=364;
        int x = 1;
        int k = 1;
        //all=x+3k;
        while(true){
            if(all-(3*k)<=100) {
                x = all-(3*k);
                break;
            }else{
                k++;
            }
        }System.out.print(x+"\n"+k);
    }
}